<?php

declare(strict_types=1);

namespace DreamCat\ControllerParamGen4Laravel\Factory;

use Dreamcat\Class2Array\Impl\DefaultJsonValueFixer;
use Dreamcat\Class2Array\JsonValueFixer;

/**
 * json编码相关的工厂
 * @author vijay
 */
class JsonDecodeFactory
{
    /**
     * 创建一个数据格式化工具
     * @return JsonValueFixer
     */
    public function createFixer(): JsonValueFixer
    {
        $fixer = new DefaultJsonValueFixer();
        $config = config("controllerParamGenerator.jsonCoder.transMode", 0);
        $o = PropertyNameTransFactory::createByMode(intval($config));
        if ($o) {
            $fixer->setPropertyNameTrans($o);
        }
        $fixer->setIgnoreUninit(config("controllerParamGenerator.jsonCoder.ignoreUndefine", true));
        return $fixer;
    }
}

# end of file
